package net.galluzzo.wave.orthopermubot.textviewproc;

import com.google.wave.api.TextView;

public class PrependIfNotPresentTextViewProcessor implements TextViewProcessor {
	protected String textToPrepend;
	
	public PrependIfNotPresentTextViewProcessor( String textToPrepend ) {
		this.textToPrepend = textToPrepend;
	}
	
	public void processTextView( TextView textView ) {
		String text = textView.getText().trim();
		if ( !text.startsWith( textToPrepend ) ) {
			textView.insert( 0, textToPrepend );
		}
	}
}
